﻿using System;
using System.ComponentModel;
using System.Web.UI;

public partial class Controls_ContentHolder_Holder1 : UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    [TemplateContainer(typeof(ContentContainer))]
    [PersistenceMode(PersistenceMode.InnerProperty)]
    [TemplateInstance(TemplateInstance.Single)]
    [Browsable(false)]
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
    public ITemplate ContentTemplate { get; set; }
    public string Title
    {
        set
        {
            labelTitle.Text = value;
        }
        get
        {
            return labelTitle.Text;
        }
    }
    public class ContentContainer : Control, INamingContainer
    {
        
    }

    protected void Page_Init()
    {
        // If a content template has been defined on the parent page then initialize the content template
        if (ContentTemplate != null)
        {
            // Instantiate and initialize the content container class
            ContentContainer container = new ContentContainer();
            ContentTemplate.InstantiateIn(container);

            // Add the content template to the placeholder so that we can see the user content
            PlaceHolderContent.Controls.Add(container);
        }
    }
 
}


